<%--
  Created by IntelliJ IDEA.
  User: AdrianJ
  Date: 2024/6/11
  Time: 16:02
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

<jsp:useBean id="timeCorrect" class="com.whu.exp1jsp.javabean.TimeCorrect">

</jsp:useBean>
<div>
    <!--购物车中-->
    <div class="cart-container">
        <h1>购物车列表</h1>
        <!--刷新-->
<%--        <div class="refresh-btn" @click="cleanCart">一键购买</div>--%>
        <!--列表-->
        <div class="inside-container scroll-container">

            <c:forEach var="item" items="${cartProducts}">
            <div class="procuct-container">
                <!--背景-->
                <div class="block-back">
                    <img :src="item.productImgs">
                    <div></div>
                </div>
                <!--图片-->
                <div class="block-img">
                    <img src="${item.productImgs}" alt="Product Image">
                </div>
                <!--基础信息容器-->
                <div class="block-basic">
                    <h2>${item.productPrice}</h2>
                    <h3>${item.productTitle}</h3>
                    <h4>发布时间：${timeCorrect.correctTime(item.publishTime)}</h4>
                    <h4>地址：${item.location}</h4>

                    <form action="purchase-servlet" method="post" style="display:inline;">
                        <input type="hidden"name="origin" value="cart">
                        <input type="hidden" name="productId" value="${item.productId}">
                        <button type="submit">直接购买</button>
                    </form>
                    <form action="remove-from-cart-servlet" method="post" style="display:inline;">
                        <input type="hidden" name="productId" value="${item.productId}">
                        <button type="submit">从购物车删除</button>
                    </form>
                </div>
                <!--介绍容器-->
                <div class="block-intro">
                    ${ item.productIntro }
                </div>
            </div>
            </c:forEach>
        </div>
    </div>
    <!--我买到的-->
    <div class="bought-container">
        <h1>我买到的</h1>
        <!--列表-->
        <div class="inside-container scroll-container">

            <c:forEach var="item" items="${purchasedProducts}">
                <div  class="procuct-container">
                    <!--背景-->
                    <div class="block-back">
                        <img src="${item.productImgs}" alt="商品图片">
                        <div></div>
                    </div>
                    <!--图片-->
                    <div class="block-img">
                        <img src="${item.productImgs}" alt="商品图片">
                    </div>
                    <!--基础信息容器-->
                    <div class="block-basic">
                        <h2>${ item.productPrice }</h2>
                        <h3>${ item.productTitle }</h3>
                        <h4>购买时间：${timeCorrect.correctTime(item.publishTime)}</h4>
                        <h4>地址：${ item.location }</h4>
                        <form action = "contact-servlet" method = "post" style="display:inline;">
                            <input type="hidden" name="productId" value="${item.productId}">
                        <button type="submit">联系卖家</button>
                        </form>
                    </div>
                    <!--介绍容器-->
                    <div class="block-intro">
                        ${ item.productIntro }
                    </div>
                </div>
            </c:forEach>
        </div>
    </div>
</div>
